OpenSea Marketplace Agent Tool

工作流概述

这是一个包含17个节点的复杂工作流,主要用于自动化处理各种任务。

工作流源代码

下载
{
  "id": "brRSLvIkYp3mLq0K",
  "meta": {
    "instanceId": "a5283507e1917a33cc3ae615b2e7d5ad2c1e50955e6f831272ddd5ab816f3fb6"
  },
  "name": "OpenSea Marketplace Agent Tool",
  "tags": [],
  "nodes": [
    {
      "id": "13579b30-83df-4da6-b0de-90eeaf3252e7",
      "name": "Marketplace Agent Brain",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -300,
        -260
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yUizd8t0sD5wMYVG",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9f979fae-49c6-4a50-b96b-92de5a49ba14",
      "name": "Marketplace Agent Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -120,
        -260
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "202ca463-f038-46df-99ea-84fbda70a933",
      "name": "OpenSea Marketplace Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        420,
        -540
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {
          "systemMessage": "### **🛒 OpenSea Marketplace Agent Overview**
This agent interacts with the OpenSea marketplace API to retrieve marketplace data, including NFT listings, offers, orders, and trait-specific data. The system follows strict input requirements to ensure compatibility with OpenSea API rules.

---

## **⚡ Available Tools & Usage Guidelines**
The OpenSea Marketplace Agent has access to the following marketplace-related tools:

---

### **1️⃣ Get All Listings (by Collection)**
📍 **Endpoint**: `/api/v2/listings/collection/{collection_slug}/all`  
🔹 **Description**: Retrieves all active, valid listings for a given collection.  
🔹 **Required Parameter**:  
   - `collection_slug` → The unique collection identifier from OpenSea.  
🔹 **Optional Query Parameters**:  
   - `limit` → Number of listings to return (1-100, default: 100).  
   - `next` → Cursor for pagination.  
🔹 **Example Query**:  
   - _\"Retrieve all active listings for the 'boredapeyachtclub' collection.\"_  

---

### **2️⃣ Get All Offers (by Collection)**
📍 **Endpoint**: `/api/v2/offers/collection/{collection_slug}/all`  
🔹 **Description**: Retrieves all valid offers for a given NFT collection, including individual and criteria-based offers.  
🔹 **Required Parameter**:  
   - `collection_slug` → The unique collection identifier from OpenSea.  
🔹 **Optional Query Parameters**:  
   - `limit` → Number of offers to return (1-100, default: 100).  
   - `next` → Cursor for pagination.  
🔹 **Example Query**:  
   - _\"Fetch all current offers for 'azuki' collection.\"_  

---

### **3️⃣ Get Best Listing (by NFT)**  
📍 **Endpoint**: `/api/v2/listings/collection/{collection_slug}/nfts/{identifier}/best`  
🔹 **Description**: Retrieves the best (cheapest) active listing for a specific NFT.  
🔹 **Required Parameters**:  
   - `collection_slug` → The collection identifier.  
   - `identifier` → The NFT token ID.  
🔹 **Optional Query Parameters**:  
   - `include_private_listings` → Boolean (default: `false`).  
🔹 **Example Query**:  
   - _\"Find the lowest-priced listing for NFT #1234 in 'doodles' collection.\"_  

---

### **4️⃣ Get Best Listings (by Collection)**  
📍 **Endpoint**: `/api/v2/listings/collection/{collection_slug}/best`  
🔹 **Description**: Retrieves the lowest-priced active listings for a specific collection.  
🔹 **Required Parameter**:  
   - `collection_slug` → The collection identifier.  
🔹 **Optional Query Parameters**:  
   - `include_private_listings` → Boolean (default: `false`).  
   - `limit` → Number of listings to return (1-100, default: 100).  
   - `next` → Cursor for pagination.  
🔹 **Example Query**:  
   - _\"Get the 10 cheapest listings for 'mutantapeyachtclub'.\"_  

---

### **5️⃣ Get Best Offer (by NFT)**  
📍 **Endpoint**: `/api/v2/offers/collection/{collection_slug}/nfts/{identifier}/best`  
🔹 **Description**: Retrieves the highest offer made for a specific NFT.  
🔹 **Required Parameters**:  
   - `collection_slug` → The collection identifier.  
   - `identifier` → The NFT token ID.  
🔹 **Example Query**:  
   - _\"Find the highest offer for NFT #5678 in 'moonbirds' collection.\"_  

---

### **6️⃣ Get Collection Offers**  
📍 **Endpoint**: `/api/v2/offers/collection/{collection_slug}`  
🔹 **Description**: Retrieves all active collection-wide offers for a specific NFT collection.  
🔹 **Required Parameter**:  
   - `collection_slug` → The collection identifier.  
🔹 **Example Query**:  
   - _\"List all collection offers for 'clonex'.\"_  

---

### **7️⃣ Get Item Offers**  
📍 **Endpoint**: `/api/v2/orders/{chain}/{protocol}/offers`  
🔹 **Description**: Retrieves all valid **individual** offers (excluding criteria-based offers).  
🔹 **Required Parameters**:  
   - `chain` → The blockchain network (must use an **allowed chain**, see below).  
   - `protocol` → The token settlement protocol (only `\"seaport\"` is supported).  
🔹 **Optional Query Parameters**:  
   - `asset_contract_address`, `cursor`, `limit`, `listed_after`, `listed_before`, `maker`, `order_by`, `order_direction`, `payment_token_address`, `taker`, `token_ids`.  
🔹 **Example Query**:  
   - _\"Fetch all active item offers for NFTs on Ethereum using Seaport protocol.\"_  

---

### **8️⃣ Get Listings (by Chain & Protocol)**  
📍 **Endpoint**: `/api/v2/orders/{chain}/{protocol}/listings`  
🔹 **Description**: Retrieves all active listings filtered by blockchain and protocol.  
🔹 **Required Parameters**:  
   - `chain` → The blockchain network (**must be an allowed chain**).  
   - `protocol` → `\"seaport\"` protocol.  
🔹 **Optional Query Parameters**:  
   - `asset_contract_address`, `cursor`, `limit`, `listed_after`, `listed_before`, `maker`, `order_by`, `order_direction`, `payment_token_address`, `taker`, `token_ids`.  
🔹 **Example Query**:  
   - _\"Retrieve all active listings for Ethereum Seaport orders.\"_  

---

### **9️⃣ Get Order (Single Order by Hash)**  
📍 **Endpoint**: `/api/v2/orders/chain/{chain}/protocol/{protocol_address}/{order_hash}`  
🔹 **Description**: Retrieves a specific order (offer or listing) based on its hash.  
🔹 **Required Parameters**:  
   - `chain` → The blockchain network (**must be an allowed chain**).  
   - `protocol_address` → **Always set to** `0x0000000000000068f116a894984e2db1123eb395`.  
   - `order_hash` → The hash of the order.  
🔹 **Example Query**:  
   - _\"Fetch details for order `0x123abc...` on Ethereum.\"_  

---

### **🔟 Get Trait Offers**  
📍 **Endpoint**: `/api/v2/offers/collection/{collection_slug}/traits`  
🔹 **Description**: Retrieves all active offers made for a specific trait in a collection.  
🔹 **Required Parameter**:  
   - `collection_slug` → The collection identifier.  
🔹 **Optional Query Parameters**:  
   - `float_value`, `int_value`, `type`, `value`.  
🔹 **Example Query**:  
   - _\"Find all offers for 'Background: Blue' in the 'azuki' collection.\"_  

---

## **⚠️ Critical Notes & Restrictions**
1. **Only Allowed Blockchains Can Be Used**  
   - ✅ Supported Chains:  
     - `amoy`, `ape_chain`, `ape_curtis`, `arbitrum`, `arbitrum_nova`, `arbitrum_sepolia`, `avalanche`, `avalanche_fuji`, `b3`, `b3_sepolia`, `baobab`, `base`, `base_sepolia`, `bera_chain`, `blast`, `blast_sepolia`, `ethereum`, `flow`, `flow_testnet`, `klaytn`, `matic`, `monad_testnet`, `mumbai`, `optimism`, `optimism_sepolia`, `sei_testnet`, `sepolia`, `shape`, `solana`, `soldev`, `soneium`, `soneium_minato`, `unichain`, `zora`, `zora_sepolia`.  
   - ❌ **Incorrect Chain Inputs Will Cause Errors**  
     - `\"polygon\"` ❌ **will fail**. Use `\"matic\"` instead.

2. **Protocol Must Be `\"seaport\"` for Item & Listing Queries**  
   - The `\"protocol\"` field must always be set to `\"seaport\"`.

3. **Fixed Protocol Address for Get Order**  
   - **For retrieving a specific order**, the `protocol_address` **must always be**:  
     - `0x0000000000000068f116a894984e2db1123eb395`.

---

## **✅ Example Queries**
- _\"Fetch all best listings for Ethereum NFTs.\"_  
- _\"Find the highest offer for a Bored Ape #456.\"_  
- _\"Get details for a specific order hash.\"_  

🚀 **Follow these rules to ensure successful API queries!**"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "c055762a-8fe7-4141-a639-df2372f30060",
      "name": "Workflow Input Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -60,
        -540
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "message"
            },
            {
              "name": "sessionId"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "e25c62f0-1047-4fbb-815c-caeaa22d2fe1",
      "name": "OpenSea Get All Listings by Collection",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        60,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/listings/collection/{collection_slug}/all",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "limit",
              "valueProvider": "modelOptional"
            },
            {
              "name": "next",
              "valueProvider": "modelOptional"
            }
          ]
        },
        "toolDescription": "This tool retrieves all active, valid listings for a single NFT collection on OpenSea, allowing pagination and limit options.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "d568d5de-82e4-4be1-b9e9-9ec56ca9d872",
      "name": "OpenSea Get All Offers by Collection",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        240,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/offers/collection/{collection_slug}/all",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "limit",
              "valueProvider": "modelOptional"
            },
            {
              "name": "next",
              "valueProvider": "modelOptional"
            }
          ]
        },
        "toolDescription": "This tool retrieves all active, valid offers for a specified NFT collection on OpenSea, including individual and criteria offers.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "1b591b2d-787f-4519-9dfc-fc0489bc0725",
      "name": "OpenSea Get Best Listing by NFT",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        440,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/listings/collection/{collection_slug}/nfts/{identifier}/best",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "include_private_listings",
              "valueProvider": "modelOptional"
            }
          ]
        },
        "toolDescription": "This tool retrieves the best available listing for a specific NFT from OpenSea.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "33222cfb-17c7-4507-8d09-fa0a7ba1beae",
      "name": "OpenSea Get Best Listings by Collection",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        640,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/listings/collection/{collection_slug}/best",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "include_private_listings",
              "valueProvider": "modelOptional"
            },
            {
              "name": "limit",
              "valueProvider": "modelOptional"
            },
            {
              "name": "next",
              "valueProvider": "modelOptional"
            }
          ]
        },
        "toolDescription": "This tool retrieves the cheapest active and valid listings for a specific NFT collection on OpenSea.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "7fd0ddd6-96eb-487d-b7a2-b8fcb29b4e22",
      "name": "OpenSea Get Best Offer by NFT",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        860,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/offers/collection/{collection_slug}/nfts/{identifier}/best",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "toolDescription": "This tool retrieves the best offers for a specific NFT on OpenSea.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "7047b8bc-ea5e-4b9b-9230-0fc46c46c58f",
      "name": "OpenSea Get Collection Offers",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        1080,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/offers/collection/{collection_slug}",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "toolDescription": "This tool retrieves the active, valid collection offers for a specified NFT collection on OpenSea.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cab63cc4-96b4-4e14-8eb7-9fca08791040",
      "name": "OpenSea Get Item Offers",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        1300,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/orders/{chain}/{protocol}/offers",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "asset_contract_address",
              "valueProvider": "modelOptional"
            },
            {
              "name": "cursor",
              "valueProvider": "modelOptional"
            },
            {
              "name": "limit",
              "valueProvider": "modelOptional"
            },
            {
              "name": "listed_after",
              "valueProvider": "modelOptional"
            },
            {
              "name": "listed_before",
              "valueProvider": "modelOptional"
            },
            {
              "name": "maker",
              "valueProvider": "modelOptional"
            },
            {
              "name": "order_by",
              "valueProvider": "modelOptional"
            },
            {
              "name": "order_direction",
              "valueProvider": "modelOptional"
            },
            {
              "name": "payment_token_address",
              "valueProvider": "modelOptional"
            },
            {
              "name": "taker",
              "valueProvider": "modelOptional"
            },
            {
              "name": "token_ids",
              "valueProvider": "modelOptional"
            }
          ]
        },
        "toolDescription": "This tool retrieves active, valid individual offers for NFTs on OpenSea. It does not include criteria offers.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "63760966-bbec-466d-83dc-a52b235df43a",
      "name": "OpenSea Get Listings",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        1500,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/orders/{chain}/{protocol}/listings",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "asset_contract_address",
              "valueProvider": "modelOptional"
            },
            {
              "name": "cursor",
              "valueProvider": "modelOptional"
            },
            {
              "name": "limit",
              "valueProvider": "modelOptional"
            },
            {
              "name": "listed_after",
              "valueProvider": "modelOptional"
            },
            {
              "name": "listed_before",
              "valueProvider": "modelOptional"
            },
            {
              "name": "maker",
              "valueProvider": "modelOptional"
            },
            {
              "name": "order_by",
              "valueProvider": "modelOptional"
            },
            {
              "name": "order_direction",
              "valueProvider": "modelOptional"
            },
            {
              "name": "payment_token_address",
              "valueProvider": "modelOptional"
            },
            {
              "name": "taker",
              "valueProvider": "modelOptional"
            },
            {
              "name": "token_ids",
              "valueProvider": "modelOptional"
            }
          ]
        },
        "toolDescription": "This tool retrieves the complete set of active, valid listings for NFTs on OpenSea.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "d0365a8a-dfd4-4a86-88cf-4e8ccbdf6c36",
      "name": "OpenSea Get Trait Offers",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        1900,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/offers/collection/{collection_slug}/traits",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "float_value",
              "valueProvider": "modelOptional"
            },
            {
              "name": "int_value",
              "valueProvider": "modelOptional"
            },
            {
              "name": "type",
              "valueProvider": "modelOptional"
            },
            {
              "name": "value",
              "valueProvider": "modelOptional"
            }
          ]
        },
        "toolDescription": "This tool retrieves the active, valid trait offers for a specified collection on OpenSea.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "148a00a5-d8f4-4708-9afd-b1111f7d71bd",
      "name": "OpenSea Get Order",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        1700,
        -260
      ],
      "parameters": {
        "url": "https://api.opensea.io/api/v2/orders/chain/{chain}/protocol/0x0000000000000068f116a894984e2db1123eb395/{order_hash}",
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "parametersQuery": {
          "values": [
            {
              "name": "chain"
            },
            {
              "name": "order_hash"
            }
          ]
        },
        "toolDescription": "This tool retrieves a single order (offer or listing) from OpenSea using its order hash. Protocol and Chain are required to prevent hash collisions. The protocol address is always set to 0x0000000000000068f116a894984e2db1123eb395.",
        "parametersHeaders": {
          "values": [
            {
              "name": "Accept",
              "value": "application/json",
              "valueProvider": "fieldValue"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3v99GVMGF4tKP5nM",
          "name": "OpenSea"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "2b616d18-f719-42dd-a616-d91ae11be009",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        -1840
      ],
      "parameters": {
        "color": 2,
        "width": 1380,
        "height": 1860,
        "content": "# OpenSea Marketplace Agent Tool (n8n Workflow) Guide

## 🚀 Workflow Overview
The **OpenSea Marketplace Agent Tool** is an **AI-driven marketplace analytics system** for **NFT trading insights**. This tool integrates with **OpenSea's API** to fetch and analyze **NFT listings, offers, orders, and trait-specific data**, helping traders and collectors make informed decisions.

### 🎯 **Key Features**:
- Retrieve **active NFT listings** for a collection.
- Fetch **valid offers** for individual NFTs or entire collections.
- Find the **cheapest available NFT listings** by collection or NFT.
- Track **the highest offer** made for an NFT or collection-wide offers.
- Access **detailed order data** based on order hash.
- Ensure **API query compliance** to prevent errors.

---

## 🔗 **Nodes & Functions**
### **1️⃣ Marketplace Agent Brain**
- **Type**: AI Language Model (GPT-4o Mini)
- **Purpose**: Processes marketplace-related API requests and user queries.

### **2️⃣ Marketplace Agent Memory**
- **Type**: AI Memory Buffer
- **Purpose**: Stores session data to maintain context across multiple queries.

### **3️⃣ OpenSea Get All Listings by Collection**
- **Type**: API Request
- **Endpoint**: `/api/v2/listings/collection/{collection_slug}/all`
- **Function**: Retrieves all active listings for a given collection.

### **4️⃣ OpenSea Get All Offers by Collection**
- **Type**: API Request
- **Endpoint**: `/api/v2/offers/collection/{collection_slug}/all`
- **Function**: Fetches all active offers made for NFTs in a collection.

### **5️⃣ OpenSea Get Best Listing by NFT**
- **Type**: API Request
- **Endpoint**: `/api/v2/listings/collection/{collection_slug}/nfts/{identifier}/best`
- **Function**: Retrieves the **lowest-priced** active listing for a specific NFT.

### **6️⃣ OpenSea Get Best Listings by Collection**
- **Type**: API Request
- **Endpoint**: `/api/v2/listings/collection/{collection_slug}/best`
- **Function**: Fetches the **cheapest listings** for a given NFT collection.

### **7️⃣ OpenSea Get Best Offer by NFT**
- **Type**: API Request
- **Endpoint**: `/api/v2/offers/collection/{collection_slug}/nfts/{identifier}/best`
- **Function**: Retrieves the **highest offer** made for a specific NFT.

### **8️⃣ OpenSea Get Collection Offers**
- **Type**: API Request
- **Endpoint**: `/api/v2/offers/collection/{collection_slug}`
- **Function**: Retrieves all **active collection-wide offers**.

### **9️⃣ OpenSea Get Item Offers**
- **Type**: API Request
- **Endpoint**: `/api/v2/orders/{chain}/{protocol}/offers`
- **Function**: Fetches **individual active offers** (excluding criteria-based offers).

### **🔟 OpenSea Get Listings by Chain & Protocol**
- **Type**: API Request
- **Endpoint**: `/api/v2/orders/{chain}/{protocol}/listings`
- **Function**: Retrieves all active **listings filtered by blockchain and protocol**.

### **11️⃣ OpenSea Get Order by Hash**
- **Type**: API Request
- **Endpoint**: `/api/v2/orders/chain/{chain}/protocol/0x0000000000000068f116a894984e2db1123eb395/{order_hash}`
- **Function**: Fetches **a specific order (listing or offer)** based on its order hash.

### **12️⃣ OpenSea Get Trait Offers**
- **Type**: API Request
- **Endpoint**: `/api/v2/offers/collection/{collection_slug}/traits`
- **Function**: Retrieves **active offers** for specific traits in a collection.

---

"
      },
      "typeVersion": 1
    },
    {
      "id": "f483a29b-626d-4c15-84a9-ac9937aea302",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        -1840
      ],
      "parameters": {
        "color": 5,
        "width": 1500,
        "height": 1080,
        "content": "
## 📌 **How to Use the Workflow**

### ✅ **Step 1: Input Data**
- Provide required parameters such as `collection_slug`, `identifier`, `chain`, `protocol`, or `order_hash`.

### ✅ **Step 2: Execute API Calls**
- The system processes requests and fetches NFT marketplace data.

### ✅ **Step 3: Analyze & Output Results**
- Results can be integrated into dashboards, alerts, or Telegram notifications.

---

## ⚠️ **Common API Queries & Examples**

### **1️⃣ Get All Listings for a Collection**
```plaintext
GET https://api.opensea.io/api/v2/listings/collection/boredapeyachtclub/all
```

### **2️⃣ Get All Offers for a Collection**
```plaintext
GET https://api.opensea.io/api/v2/offers/collection/azuki/all
```

### **3️⃣ Get Best Listing for an NFT**
```plaintext
GET https://api.opensea.io/api/v2/listings/collection/doodles/nfts/1234/best
```

### **4️⃣ Get Best Offer for an NFT**
```plaintext
GET https://api.opensea.io/api/v2/offers/collection/moonbirds/nfts/5678/best
```

### **5️⃣ Get Order Details by Order Hash**
```plaintext
GET https://api.opensea.io/api/v2/orders/chain/ethereum/protocol/0x0000000000000068f116a894984e2db1123eb395/0x123abc...
```

---

"
      },
      "typeVersion": 1
    },
    {
      "id": "6c111fd9-0076-438e-8516-3a0e03e63510",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -1840
      ],
      "parameters": {
        "color": 3,
        "width": 1060,
        "height": 520,
        "content": "## ⚡ **Error Handling & Troubleshooting**
| **Error Code** | **Description** |
|--------------|----------------|
| `200` | Success |
| `400` | Bad Request (Invalid input) |
| `404` | Not Found (Incorrect slug, address, or identifier) |
| `500` | Server Error (OpenSea API issue) |

### 🔹 **Fixing Common Errors**
- Ensure correct **collection slug** and **NFT identifier**.
- Always use `\"matic\"` instead of `\"polygon\"` for chain input.
- Verify that the **protocol is set to `\"seaport\"`** where required.
- **Order hash queries require the fixed protocol address:** `0x0000000000000068f116a894984e2db1123eb395`.
- Retry after some time if the OpenSea API is experiencing downtime.

---

## 🚀 **Connect with Me for Support**
If you need assistance, custom OpenSea marketplace insights, or automation support, feel free to connect with me on LinkedIn:

🌐 **Don Jayamaha – LinkedIn**  
🔗 [http://linkedin.com/in/donjayamahajr](http://linkedin.com/in/donjayamahajr)
"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f82ae6e7-43e0-4c9d-ae7e-0ddacc93a92a",
  "connections": {
    "OpenSea Get Order": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get Listings": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Input Trigger": {
      "main": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Marketplace Agent Brain": {
      "ai_languageModel": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get Item Offers": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Marketplace Agent Memory": {
      "ai_memory": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get Trait Offers": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get Best Offer by NFT": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get Collection Offers": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get Best Listing by NFT": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get All Offers by Collection": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get All Listings by Collection": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenSea Get Best Listings by Collection": {
      "ai_tool": [
        [
          {
            "node": "OpenSea Marketplace Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}

功能特点

  • 自动检测新邮件
  • AI智能内容分析
  • 自定义分类规则
  • 批量处理能力
  • 详细的处理日志

技术分析

节点类型及作用

  • @N8N/N8N Nodes Langchain.Lmchatopenai
  • @N8N/N8N Nodes Langchain.Memorybufferwindow
  • @N8N/N8N Nodes Langchain.Agent
  • Executeworkflowtrigger
  • @N8N/N8N Nodes Langchain.Toolhttprequest

复杂度评估

配置难度:
★★★★☆
维护难度:
★★☆☆☆
扩展性:
★★★★☆

实施指南

前置条件

  • 有效的Gmail账户
  • n8n平台访问权限
  • Google API凭证
  • AI分类服务订阅

配置步骤

  1. 在n8n中导入工作流JSON文件
  2. 配置Gmail节点的认证信息
  3. 设置AI分类器的API密钥
  4. 自定义分类规则和标签映射
  5. 测试工作流执行
  6. 配置定时触发器(可选)

关键参数

参数名称 默认值 说明
maxEmails 50 单次处理的最大邮件数量
confidenceThreshold 0.8 分类置信度阈值
autoLabel true 是否自动添加标签

最佳实践

优化建议

  • 定期更新AI分类模型以提高准确性
  • 根据邮件量调整处理批次大小
  • 设置合理的分类置信度阈值
  • 定期清理过期的分类规则

安全注意事项

  • 妥善保管API密钥和认证信息
  • 限制工作流的访问权限
  • 定期审查处理日志
  • 启用双因素认证保护Gmail账户

性能优化

  • 使用增量处理减少重复工作
  • 缓存频繁访问的数据
  • 并行处理多个邮件分类任务
  • 监控系统资源使用情况

故障排除

常见问题

邮件未被正确分类

检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。

Gmail认证失败

确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。

调试技巧

  • 启用详细日志记录查看每个步骤的执行情况
  • 使用测试邮件验证分类逻辑
  • 检查网络连接和API服务状态
  • 逐步执行工作流定位问题节点

错误处理

工作流包含以下错误处理机制:

  • 网络超时自动重试(最多3次)
  • API错误记录和告警
  • 处理失败邮件的隔离机制
  • 异常情况下的回滚操作